package com.yunfei.yunhetong.heTongSignManager.service.impl;
import java.util.*;
import com.yunfei.utils.SnowflakeIdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.yunfei.utils.BaseException;
import com.yunfei.utils.log.BaseLog;
import com.yunfei.utils.string.StringUtil;
import com.yunfei.utils.id.IdUtils;
import com.yunfei.mapper.aiiidb.HeTongSignManagerMapper;
import com.yunfei.yunhetong.heTongSignManager.bo.*;
import com.yunfei.yunhetong.heTongSignManager.entity.*;
import com.yunfei.yunhetong.heTongSignManager.service.*;
import com.yunfei.yunhetong.heTongSignManager.service.impl.*;
   /**
    *@tablename hetongsignmanager
    *@author zhengyunfei
    *@createDate Thu Aug 08 09:31:33 CST 2019
    */ 
	@Service("hetongsignmanagerService")
	public class HeTongSignManagerServiceImpl implements HeTongSignManagerService{
	@Autowired
	private HeTongSignManagerMapper heTongSignManagerMapper;
	/**
	*新增
	*@author zhengYunFei
	*@date Thu Aug 08 09:31:33 CST 2019
	*/
	public String add(HeTongSignManagerBo bo){
	String backInfo="保存成功";
	String id="";
		try{
			HeTongSignManagerEntity entity=HeTongSignManagerBo.boToEntity(bo);
			id= IdUtils.getId();
			heTongSignManagerMapper.add(entity);
		}catch(Exception e){
			 backInfo="保存失败";
			 BaseLog.e(this.getClass(), "add 添加失败", e);
			 throw new BaseException("添加！",e);
		}
		return id;
}
	/**
	*新增
	*@author zhengYunFei
	*@date Thu Aug 08 09:31:33 CST 2019
	*/
	public String batchInsert(List list){
	String backInfo="保存成功";
	String id="";
		try{
			heTongSignManagerMapper.add(list);
		}catch(Exception e){
			 backInfo="保存失败";
			 BaseLog.e(this.getClass(), "batchInsert 添加失败", e);
			 throw new BaseException("添加！",e);
		}
		return id;
}
	/**
	*修改
	*@author zhengYunFei
	*@date Thu Aug 08 09:31:33 CST 2019
	*/
	public String update(HeTongSignManagerBo bo){
	String backInfo="修改成功";
		try{
			HeTongSignManagerEntity entity=HeTongSignManagerBo.boToEntity(bo);
			heTongSignManagerMapper.update(entity);
		}catch(Exception e){
			 backInfo="保存失败";
			 BaseLog.e(this.getClass(), "update更新失败", e);
			 throw new BaseException("更新！",e);
		}
		return backInfo;
}
	/**
	*删除
	*@author zhengYunFei
	*@date Thu Aug 08 09:31:33 CST 2019
	*/
	public String delete(String id){
	String backInfo="删除成功";
		try{
			Map<String,Object> map=new HashMap<String, Object>();
			map.put("id",id.split(","));
			heTongSignManagerMapper.delete(map);
		}catch(Exception e){
			 backInfo="保存失败";
			 BaseLog.e(this.getClass(), "add 添加失败", e);
			 throw new BaseException("添加！",e);
		}
		return backInfo;
}
	/**
	*根据Id查询
	*@author zhengYunFei
	*@date Thu Aug 08 09:31:33 CST 2019
	*/
	public HeTongSignManagerBo findById(String id){
		HeTongSignManagerEntity entity=null;
		HeTongSignManagerBo bo=null;
		try{
			entity=(HeTongSignManagerEntity)heTongSignManagerMapper.findById(id);
		if(!StringUtil.isNullOrEmpty(entity)){
				bo=HeTongSignManagerBo.entityToBo(entity);
			}
		}catch(Exception e){
			 BaseLog.e(this.getClass(), "findById 查询失败", e);
			 throw new BaseException("查询！",e);
	}
		return bo;
	}
	/**
	*根据Id查询
	*@author zhengYunFei
	*@date Thu Aug 08 09:31:33 CST 2019
	*/
	public HeTongSignManagerBo findByMap(Map queryMap){
		HeTongSignManagerEntity entity=null;
		HeTongSignManagerBo bo=null;
		try{
			entity=(HeTongSignManagerEntity)heTongSignManagerMapper.get(queryMap);
			if(!StringUtil.isNullOrEmpty(entity)){
				bo=HeTongSignManagerBo.entityToBo(entity);
			}
		}catch(Exception e){
			BaseLog.e(this.getClass(), "findById 查询失败", e);
			 throw new BaseException("查询！",e);
		}
		return bo;
}
	/**
	*根据Id查询
	*@author zhengYunFei
	*@date Thu Aug 08 09:31:33 CST 2019
	*/
	public HeTongSignManagerBo findByBo(HeTongSignManagerBo param){
		HeTongSignManagerEntity entity=null;
		HeTongSignManagerBo bo=null;
		try{
			entity=(HeTongSignManagerEntity)heTongSignManagerMapper.findByBo(param);
			if(!StringUtil.isNullOrEmpty(entity)){
				bo=HeTongSignManagerBo.entityToBo(entity);
			}
		}catch(Exception e){
			 BaseLog.e(this.getClass(), "findById 查询失败", e);
			 throw new BaseException("查询！",e);
		}
		return bo;
}
	/**
	*查询所有信息
	*@author zhengYunFei
	*@date Thu Aug 08 09:31:33 CST 2019
	*/
	public List<HeTongSignManagerBo> findAllList(HeTongSignManagerBo map){
		List<HeTongSignManagerBo> boList=new ArrayList<HeTongSignManagerBo>();
		List<HeTongSignManagerEntity> entityList=new ArrayList<HeTongSignManagerEntity>();
		try{
					entityList=heTongSignManagerMapper.findAllList( map);
				for(int i=0;i<entityList.size();i++){
					HeTongSignManagerEntity entity=entityList.get(i);
					HeTongSignManagerBo bo=HeTongSignManagerBo.entityToBo(entity);
					boList.add(bo);
				}
		}catch(Exception e){
				BaseLog.e(this.getClass(), "findAllList 查询失败", e);
				throw new BaseException("查询！",e);
		}
		return boList;
}
	/**
	*查询所有信息
	*@author zhengYunFei
	*@date Thu Aug 08 09:31:33 CST 2019
	*/
	public List<HeTongSignManagerBo> findAllList(Map<String,Object> map){
		List<HeTongSignManagerBo> boList=new ArrayList<HeTongSignManagerBo>();
		List<HeTongSignManagerEntity> entityList=new ArrayList<HeTongSignManagerEntity>();
		try{
				entityList=heTongSignManagerMapper.findAllList( map);
			for(int i=0;i<entityList.size();i++){
				HeTongSignManagerEntity entity=entityList.get(i);
				HeTongSignManagerBo bo=HeTongSignManagerBo.entityToBo(entity);
				boList.add(bo);
			}
		}catch(Exception e){
			BaseLog.e(this.getClass(), "findAllList 查询失败", e);
		throw new BaseException("查询！",e);
		}
		return boList;
}
	/**
	*查询所有信息
	*@author zhengYunFei
	*@date Thu Aug 08 09:31:33 CST 2019
	*/
	public List<HeTongSignManagerBo> findAllListPage(HeTongSignManagerBo param){
		List<HeTongSignManagerBo> boList=new ArrayList<HeTongSignManagerBo>();
		List<HeTongSignManagerEntity> entityList=new ArrayList<HeTongSignManagerEntity>();
		try{
		entityList=heTongSignManagerMapper.findAllListPage(param);
			for(int i=0;i<entityList.size();i++){
				HeTongSignManagerEntity entity=entityList.get(i);
				HeTongSignManagerBo bo=HeTongSignManagerBo.entityToBo(entity);
				boList.add(bo);
		}
		}catch(Exception e){
			 BaseLog.e(this.getClass(), "findAllList 查询失败", e);
			 throw new BaseException("查询！",e);
		}
		return boList;
}
	/**
	*查询所有信息
	*@author zhengYunFei
	*@date Thu Aug 08 09:31:33 CST 2019
	*/
	public int count(HeTongSignManagerBo bo){
		int count=0;
		try{
			    HeTongSignManagerEntity entity=HeTongSignManagerBo.boToEntity(bo);
			    count=(Integer)heTongSignManagerMapper.count(entity);
			}catch(Exception e){
				 BaseLog.e(this.getClass(), "findById 查询失败", e);
				 throw new BaseException("查询！",e);
			}
		return count;
	}
}

